<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/easyui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/easyui/themes/icon.css">
<script type="text/javascript" src="${pageContext.request.contextPath}/static/easyui/jquery.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/easyui/locale/easyui-lang-zh_CN.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>员工请假系统登录页面</title>
</head>
<body>
<div style="position: absolute;width: 100%;height: 100%;z-index: -1;left: 0;top: 0">
	<img src="${pageContext.request.contextPath}/static/images/login_bg.jpg" width="100%" height="100%" style="left: 0;top: 0;">
</div>
<div  class="easyui-window" title="用户登录" style="width:350px;height:300px;padding:10px"   
        data-options="iconCls:'icon-save',collapsible:false,minimizable:false,maximizable:false,
        closable:false,modal:false,draggable:false,resizable:false">   
     <center>
     <form id="myForm" >
		<table style="width:100%;height:100%;" cellpadding="6px" align="center" >
			<tr align="center">
				<th colspan="2" style="padding-bottom: 10px"><big>用户登录</big></th>
			</tr>
			<tr>
				<td>用户名：</td>
				<td>
					<input type="text" id="userName" name="userLoginname" class="easyui-validatebox" required="true" style="width: 200px"/>
				</td>
			</tr>
			<tr>
				<td>密码：</td>
				<td>
					<input type="password" id="password" name="userPassword" class="easyui-validatebox" required="true" style="width: 200px"/>
				</td>
			</tr>
			<tr>
				<td>角色：</td>
				<td>
					<input  id="groupId" name="roleName" class="easyui-combobox" data-options="panelHeight:'auto'" value="请选择"/>
				</td>
			</tr>
			<tr>
				<td></td>
				<td><span id="errorInfo"  style="color: red;visibility: hidden">fff</span></td>
			</tr>
			<tr>
				<td></td>
				<td align="right">
					<a href="javascript:submitData()" class="easyui-linkbutton" iconCls="icon-submit">登录</a>&nbsp;
					<a href="javascript:resetValue()" class="easyui-linkbutton" iconCls="icon-reset">重置</a>
				</td>
			</tr>
		</table>
     </form>
</center>
</div>
</body>
<script type="text/javascript">
$(function(){
	var js = '${roleList }';
	var arr = $.parseJSON(js).roleList;
	$("#groupId").combobox({
		valueField:'roleName',
		textField:'roleName',
		data:arr
	})
})
function submitData(){
	$('#myForm').form('submit', {
		url: "${pageContext.request.contextPath}/userAuth",
		onSubmit: function(){
			if($("#groupId").val() == "请选择"){
				$.messager.alert("提示","请选择角色!","info");
				return false;
			}
			return $(this).form('validate');	
		},
		success: function(data){
			var js = $.parseJSON(data);
			var url = js.url;
			if(js.errorInfo == null){
				window.location.href= "${pageContext.request.contextPath}"+url;
			}else{
				$("#errorInfo").html(js.errorInfo);
				$("#errorInfo").css("visibility","visible");
			}
		}
	});
}
function resetValue(){
	$("#userName").val("");
	$("#password").val("");
	$("#groupId").combobox("setValue","请选择");
	$("#errorInfo").css("visibility","hidden");
}


</script>



</html>